<h4>模型驱动</h4>
<form [formGroup]="contactForm" (submit)="handleSubmit()">
  <div formGroupName="info">
    <fieldset>
      <div>基础信息</div>
      <input type="text" formControlName="username" />
      <input type="number" formControlName="age" />
    </fieldset>
  </div>
  <div formArrayName="hobbies">
    <fieldset>
      <div>爱好</div>
      <div *ngFor="let item of hobbies.controls; let i = index">
        <div [formGroupName]="i">
          爱好{{ i + 1 }}：<input type="text" formControlName="hobby" />
          <button (click)="createHobby()">添加爱好</button>
          <button (click)="removeHobby(i)">删除爱好</button>
        </div>
      </div>
      <div>{{ hobbies.errors | json }}</div>
    </fieldset>
  </div>
  <button [disabled]="contactForm.invalid">提交</button>
</form>
